package com.jsle.common.artifactory;

import java.util.Locale;

import javax.servlet.ServletContextEvent;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

/**
 * 重写spring ContextLoaderListener 以构建spring context
 * @author wisdying
 * @date 2012-11-10
 */
public class DefaultContextLoaderListener extends ContextLoaderListener{
	
		@SuppressWarnings("unused")
		private Log log = LogFactory.getLog(DefaultContextLoaderListener.class);

		@SuppressWarnings("static-access")
		@Override
		public void contextInitialized(ServletContextEvent event) {
			super.contextInitialized(event);
			WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());
			ContextUtil.getInstance().setApplicationContext(context);
			ContextUtil.getInstance().setLocal(Locale.getDefault());
			
		}
		
}
